<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>CMS111</title>
    <link href="__CSS__/common.css" rel="stylesheet"/>
    <link href="__CSS__/right.css" rel="stylesheet"/>
    <link rel="stylesheet" href="__INC__/form/css/zebra_form.css" type="text/css">
    <script type="text/javascript" language="javascript" src="__JS__/jquery-1.7.2.min.js"></script>
    <script charset="utf-8" src="__JS__/common.js"></script>
    <script type="text/javascript" language="javascript">
        $(document).ready(function () {
            $(".table_list tr").mouseover(function () {
                $(this).addClass("one");
            })
            $(".table_list tr").mouseout(function () {
                $(this).removeClass("one");
            })
        });
    </script>
    <style type="text/css">
        .one {
            background: #fcfcfc;
        }
    </style>
</head>
<body>
<!--右侧区域 begin-->
<div class="right">
    <!--当前位置 begin-->
    <include file='common:crumbs'/>
    <!--当前位置 end-->
    <!--主体区域 begin-->
    <div class="container">
        <div class="alert_div">
            <h4 class="alert_info"><span class="welcome">{$welcome}</span>您现在的位置是：{$current} </h4>
            <h4 class="alert_what" style="display:none;"></h4>
        </div>
        <!--样式一 begin-->
        <div class="stats">
            <div class="lm_title">
                <div class="lm_title_l"><em>操作面板</em></div>
            </div>
            <div class="lm_content">
                <div id="panel">
                    <div class="infos_left">
                        <table class="Zebra_Form">
                            <tr class="row">
                                <td><label>快捷操作:</label></td>
                                <td colspan="2"><input type="text" id="newConfigType" class="text" value="" style="width:180px;"/></td>
                                <td {$add_style} ><input type="button" class="button" onclick="openpanel('add')" value="添加新的参数"/></td>
                            </tr>
                        </table>
                    </div>
                    <div class="clear"></div>
                </div>
            </div>
            <div class="lm_bottom">
                <div class="lm_bottom_l"><em></em></div>
            </div>
        </div>
        <!--样式一 end-->
        <!--样式二 begin-->
        <div class="stats">
            <div class="lm_title">
                <div class="lm_title_l"><em>{$current}</em></div>
            </div>
            <div class="lm_table">
                <table cellpadding="0" cellspacing="0" width="100%" class="table_list">
                    <tr class="title" align="center">
                        <td>选择号</td>
                        <td>序号</td>
                        <td>系统参数类别名</td>
                        <td>写入配置</td>
                        <td>操作</td>
                    </tr>
                    <volist name='configTypeArr' id='vo'>
                        <tr class="tr_line">
                            <td colspan="10">
                                <div></div>
                            </td>
                        </tr>
                        <tr align="left">
                            <td><input type="checkbox" name="_check[]" value="{$vo.id}"></td>
                            <td>{$vo.id}</td>
                            <td><span class="typename_edit_{$vo.id}">{$vo.typename}</span></td>
                            <td><?php if($vo['display'] == 1) echo "是"; else echo "否"; ?></td>
                            <td width="120px">
                                <a href="javascript:openpanel('edit',{$vo['id']})">修改</a> |
                                <a href="javascript:openpanel('del',{$vo['id']})">删除</a>
                            </td>
                        </tr>
                    </volist>
                </table>
            </div>
            <div class="lm_table_bottom">
                <div class="lm_table_bottom_l"><em>
                </em>
                </div>
            </div>
        </div>
        <!--样式二 end-->
    </div>
    <!--主体区域 end-->
</div>
<!--右侧区域  end-->
<!--弹出层二begin-->
<div class="popupPanel">
    <div class="stats">
        <div class="lm_title">
            <div class="lm_title_l"><em id="panelTitle">做什么？</em></div>
        </div>
        <div class="lm_content">
            <table class="Zebra_Form" style="width:100%;">
                <tr class="row">
                    <input type="hidden" id="controlitems" value=""/>
                    <input type="hidden" id="panelaction" value=""/>
                    <td width="60"><label>类别名：</label></td>
                    <td colspan="2"><input type="text" class="text" id="configType" value=""/></td>
                </tr>
                <tr class="row displayPanel">
                    <td width="80"><label>写入配置：</label></td>
                    <td colspan="2">
                        是：<input type="radio" name="display" value="1" class="control radio" checked="checked">
                        否：<input type="radio" name="display" value="0" class="control radio">
                    </td>
                </tr>
                <tr class="row">
                    <td></td>
                    <td><input type="button" onclick="panelDo()" class="button" value="确定"/></td>
                    <td><input type="button" class="button" onclick="panelClose()" value="取消"/></td>
                </tr>
            </table>
        </div>
        <div class="lm_bottom">
            <div class="lm_bottom_l"><em></em></div>
        </div>
    </div>
</div>
<!--弹出层二end-->
</body>
<script>
    //开启panel窗口
    function openpanel(act, item) {
        //初始化关闭所有附加panel
        $(".displayPanel").hide();
        if (act == "add") {
            var typename = $.trim($('#newConfigType').val());
            if (typeof(typename) == 'undefined' || typename == '') {
                jl_notify(3, '栏目名称不能为空！');
                return;
            }
        }
        if (act == 'add') {
            $(".displayPanel").show();
            $("#panelTitle").text("你确定要添加该类别？");
            $("#panelaction").val("add");
            $("#configType").val(typename);
            var obj = $('.popupPanel');
            jl_fadeIn(obj);
        } else if (act == 'edit') {
            $(".displayPanel").show();
            if (typeof(item) == 'undefined' || item == '') {
                jl_notify(2, "不知道要修改哪一个类别！");
                return;
            }
            $("#controlitems").val(item);
            $("#panelTitle").text("你确定要修改该类别？");
            $("#panelaction").val("edit");
            var typename = $(".typename_edit_" + item).text();
            $("#configType").val(typename);
            var obj = $('.popupPanel');
            jl_fadeIn(obj);
        } else if (act == 'del') {
            var typename = $(".typename_edit_" + item).text();
            $("#configType").val(typename);
            $("#configType").attr('readonly', 'true');
            if (typeof(item) == 'undefined' || item == '') {
                jl_notify(2, "不知道要修改哪一个类别！");
                return;
            }
            $("#controlitems").val(item);
            $("#panelTitle").text("你确定要删除该类别？");
            $("#panelaction").val("del");
            var obj = $('.popupPanel');
            jl_fadeIn(obj);
        } else {
            jl_notify(3, "不知道你到底要干什么！");
            return;
        }

    }

    //关闭panel窗口
    function panelClose() {
        var obj = $('.popupPanel');
        jl_fadeOut(obj);
    }

    //panel执行操作
    function panelDo() {
        var act = $("#panelaction").val();
        if (act == '') {
            jl_notify(3, "不知道你到底要干什么！");
            return;
        }
        if (act == 'add' || act == 'edit') {
            jl_fadeOut($('.popupPanel'));
            var typename = $.trim($("#configType").val());
            var display = $(":radio[checked]").val();
            if (typename == '' || typeof(typename) == 'undefined') {
                jl_notify(2, "类别名称不能为空！");
                return;
            }
            if (act == 'edit') {
                var item = $("#controlitems").val();
            } else {
                var item = -1;
            }
            $.post("__GROUP__/ajax/configType", {act: act, typename: typename, display: display, item: item}, function (data) {
                if (data == -1) {
                    jl_notify(2, "呜呜，操作失败！");
                } else if (data == 1) {
                    //jl_notify(1,"嘻嘻，删除栏目成功！");
                    location.href = location.href;
                } else {
                    jl_notify(2, "呜呜，种种原因导致操作失败！");
                }
            });
        } else if (act == 'del') {
            var item = $("#controlitems").val();
            $.post("__GROUP__/ajax/configType", {act: act, item: item}, function (data) {
                if (data == -1) {
                    jl_notify(2, "呜呜，删除该栏目失败！");
                } else if (data == 1) {
                    //jl_notify(1,"嘻嘻，删除栏目成功！");
                    location.href = location.href;
                } else if (data == -2) {
                    jl_notify(2, "该类别下还有内容，不能删除！");
                } else {
                    jl_notify(2, "呜呜，种种原因导致删除该栏目失败！");
                }
            });
        } else {
            jl_notify(3, "不知道你到底要干什么！");
            return;
        }
    }
</script>
</html>